module.exports = {
	// 加载
	loading(title) {
		uni.showLoading({
			title: title ? title : '请稍后'
			, mask: true
		});
	}
	// 隐藏加载
	, hideLoading() {
		uni.hideLoading({
			noConflict: true
		});
	}
	// 消息提示
	, msg(title, call) {
		uni.showToast({
			title: title,
			icon: 'none',
			duration: 1500,
			mask: true
		});
		call && setTimeout(() => {
			call();
		}, 1500);
	}
	// 成功消息
	, msgOk(title, call) {
		uni.showToast({
			title: title,
			icon: 'success',
			duration: 1500,
			mask: true
		});
		call && setTimeout(() => {
			call();
		}, 1500);
	}
	// 错误消息
	, msgError(title, call) {
		uni.showToast({
			title: title,
			icon: 'error',
			duration: 1500,
			mask: true
		});
		call && setTimeout(() => {
			call();
		}, 1500);
	}
	// 确认弹窗
	, modal(title, text, call, btnName) {
		uni.showModal({
			title: title,
			content: text,
			showCancel: false,
			confirmText: btnName ? btnName : '确定'
		});
	}
	// 确认取消弹窗
	, modal2(title, text, okCall, cancelCall, okBtnName, cancelBtnName) {
		uni.showModal({
			title: title,
			content: text,
			confirmText: okBtnName ? okBtnName : '确定',
			cancelText: cancelBtnName ? cancelBtnName : '取消',
			success (res) {
				res.confirm && okCall && okCall();
				res.cancel && cancelCall && cancelCall();
			}
		});
	},
	Navigoto(url){
		uni.navigateTo({
			url
		})
	}
};